using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

// TODO: replace this with the type you want to read.
using TRead = lumo.display.object2D.Tiled;
using System.IO;

namespace lumo.display.object2D
{
    /// <summary>
    /// Reader for Tiled tmx object.
    /// </summary>
    public class TiledReader : ContentTypeReader<TRead>
    {
        /// <summary>
        /// Read the string.
        /// </summary>
        /// <param name="input">The Reader</param>
        /// <param name="existingInstance">The instance of the object</param>
        /// <returns>The tiled class.</returns>
        protected override TRead Read(ContentReader input, TRead existingInstance)
        {
            // Read the text.
            System.String String = input.ReadString();

            // Return the tiled class.
            return Tiled.Load(new StringReader(String), input.ContentManager);
        }
    }
}
